package com.open.pay.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.open.common.resp.ResultInfo;
import com.open.pay.resp.PayDTO;
import com.open.pay.service.PayService;

@RestController
public class PayController {

	@Autowired
	private PayService payService;

	@GetMapping("/pay/getPayById/{id}")
	public ResultInfo<PayDTO> getPayById(@PathVariable("id") Integer id) {
		return new ResultInfo<PayDTO>("200", "success", payService.getPayById(id));
	}
	
	@PostMapping("/pay/addOrder")
	public ResultInfo<String> addOrder(@RequestBody PayDTO dto) {
		payService.addOrder(dto);
		return new ResultInfo<String>("200", "success");
	}
}
